/* GUI CONVERTED from adcsiq.p (converter v1.75) Sun Aug 13 21:08:37 2000 */
/* adcsiq.p - CUSTOMER INQUIRY                                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*K179*/
/*V8:ConvertMode=Report                                        */
/* REVISION: 1.0      LAST MODIFIED: 09/02/87   BY: EMB                 */
/* REVISION: 6.0      LAST MODIFIED: 01/09/91   BY: dld *D291*          */
/* REVISION: 6.0      LAST MODIFIED: 02/07/91   BY: dld *D335*          */
/* REVISION: 7.3      LAST MODIFIED: 11/19/92   BY: jcd *G339*          */
/* REVISION: 7.3      LAST MODIFIED: 07/01/94   BY: afs *FP21*          */
/* REVISION: 7.3      LAST MODIFIED: 08/28/94   BY: bcm *GL74*          */
/* REVISION: 7.3      LAST MODIFIED: 09/30/94   BY: rxm *FR96*          */
/* REVISION  7.3      LAST MODIFIED: 05/26/95   BY: vrn *F0SB*          */
/* REVISION  8.6      LAST MODIFIED: 10/31/97   BY: mur *K179*          */
/* REVISION  9.0      LAST MODIFIED: 03/10/99   BY: *M0B3* Michael Amaladhas */
/* REVISION  9.0      LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan        */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/11/00 BY: *N0KK* jyn                 */

     /* DISPLAY TITLE */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

     {mfdtitle.i "b+ "}

     define variable code like pm_addr.
     define variable sort like pm_sort.

     
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
/*GL74*/    
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
space(1)
        sort code
     with frame a side-labels /*GL74*/ width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



     /* SET EXTERNAL LABELS */
     setFrameLabels(frame a:handle).

/*K179*/ {wbrp01.i}
        repeat:

/*K179*/ if c-application-mode <> 'web' then
        update sort code with frame a.

/*K179*/ {wbrp06.i &command = update &fields = "  sort code" &frm = "a"}

/*K179*/ if (c-application-mode <> 'web') or
/*K179*/ (c-application-mode = 'web' and
/*K179*/ (c-web-request begins 'data')) then do:

        hide frame b.

/*K179*/ end.
        /* SELECT PRINTER */
        {mfselprt.i "terminal" 80}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


/*FP21******(Rewrote loop to sort by ad_sort instead of pm_sort)
 *          if code = "" or (sort > "" and code > "") then
 *          for each pm_mstr where pm_sort >= sort and pm_addr >= code
 *             no-lock by pm_sort with frame b width 132 no-attr-space:
 *                                      {mfrpchk.i}                     /*G339*/
 *             find ad_mstr where ad_addr = pm_addr no-lock.
 *             display ad_sort format "x(25)"
 *             pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip.
 *          end.
 *          else
 *          for each pm_mstr where  pm_addr >= code
 *             no-lock by pm_addr with frame c width 132 no-attr-space:
 *                                      {mfrpchk.i}                     /*G339*/
 *             find ad_mstr where ad_addr = pm_addr no-lock.
 *             display ad_sort format "x(25)"
 *             pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip.
 *          end.
 **FP21*/

/*F0SB* COMMENTED OUT - THE FIX IS BEING ROLLED BACKED BECAUSE THE ORIGINAL
*   PROBLEM REPORTED BY THE USER WAS NOT INTERPRETED CORRECTLY.
*   WE ARE NOW DISPLAYING vd_sort FIELD AND  USING vd_sort FOR THE SORT
*   ORDER.
*   THE FOLLOWING PIECE OF CODE IS VERY INEFFICIENT IN TERMS OF
*   PROCESSING AND BESIDES CONFUSES THE USER BY DISPLAYING ONE sort FIELD
*   WHILE SORTING BY THE OTHER
* /*FP21*/    if code = "" or (sort > "" and code > "") then
*       for each pm_mstr no-lock where pm_addr >= code,
*       each ad_mstr no-lock where ad_addr =  pm_addr
*                      and ad_sort >= sort
*          by ad_sort with frame b width 132 no-attr-space:
*
*          {mfrpchk.i}
*
*          display ad_sort format "x(25)"
*        pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip.
*       end.
*       else
* /*FR96*/    if sort = "" and code > "" then
* /*FR96*/    for each pm_mstr no-lock where pm_addr >= code,
* /*FR96*/        each ad_mstr no-lock where ad_addr = pm_addr
* /*FR96*/       by pm_addr with frame d width 132 no-attr-space:
*
* /*FR96*/       {mfrpchk.i}
*
* /*FR96*/       display ad_sort format "x(25)"
* /*FR96*/         pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip.
* /*FR96*/    end.
* /*FR96*/    else
*       for each pm_mstr no-lock where pm_addr >= code,
*       each ad_mstr no-lock where ad_addr =  pm_addr
*          by ad_sort with frame c width 132 no-attr-space:
*
**         {mfrpchk.i}
*
*          display ad_sort format "x(25)"
*        pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip.
*
* /*FP21*/    end.
*
*F0SB - COMMENTED OUT */

/*F0SB*/   if code = "" or (sort > "" and code > "") then
/*F0SB*/   for each pm_mstr where pm_sort >= sort and pm_addr >= code
/*F0SB*/      no-lock by pm_sort with frame b width 132 no-attr-space:
              /* SET EXTERNAL LABELS */
              setFrameLabels(frame b:handle).
/*F0SB*/      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

/*F0SB*/      find ad_mstr where ad_addr = pm_addr no-lock.
/*F0SB*/      display pm_sort format "x(25)"
/*F0SB*/      pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip WITH STREAM-IO /*GUI*/ .
/*F0SB*/   end.
/*F0SB*/   else
/*F0SB*/   for each pm_mstr where  pm_addr >= code
/*F0SB*/      no-lock by pm_addr with frame c width 132 no-attr-space:
              /* SET EXTERNAL LABELS */
              setFrameLabels(frame c:handle).
/*F0SB*/      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

/*F0SB*/      find ad_mstr where ad_addr = pm_addr no-lock.
/*F0SB*/      display pm_sort format "x(25)"
/*F0SB*/      pm_addr ad_phone ad_city format "X(10)" ad_state ad_zip WITH STREAM-IO /*GUI*/ .
/*F0SB*/   end.

        {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

        {mfmsg.i 8 1}
     end.

/*K179*/ {wbrp04.i &frame-spec = a}
